//
//  MapViewController.m
//  QuLuoMianApp
//
//  Created by zyz on 2017/12/24.
//  Copyright © 2017年 科大讯飞. All rights reserved.
//

#import "MapViewController.h"
#import <MapKit/MapKit.h>

@interface MapViewController ()<MKMapViewDelegate>
@property (nonatomic,strong) MKMapView * mapView;
@end

@implementation MapViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"趣罗免";
    
    
    // 想要跟随用户的位置
    self.mapView.userTrackingMode = MKUserTrackingModeFollow;
    
    // 设置代理
    self.mapView.delegate = self;
    
    // 设置地图的类型
    self.mapView.mapType = MKMapTypeStandard;
    
    // 设置地图中心的经度、纬度
    CLLocationCoordinate2D center = {25.3366372782,102.4580883980};;
    // 设置地图显示的范围，地图显示范围越小，细节越清楚
    MKCoordinateSpan span = MKCoordinateSpanMake(0.005,0.005);
    // 创建MKCoordinateRegion对象，该对象代表地图的显示中心和显示范围
    MKCoordinateRegion region =MKCoordinateRegionMake(center, span);
    
    // 设置当前地图的显示中心和显示范围
    [self.mapView setRegion:region animated:YES];
    
    
}

#pragma mark - 懒加载

- (MKMapView *)mapView{
    if (!_mapView) {
        _mapView  = [[MKMapView alloc] initWithFrame:self.view.bounds];
        _mapView.delegate = self;
        _mapView.zoomEnabled = YES;
        [self.view addSubview:_mapView];
    }
    return _mapView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
